<?php

declare(strict_types=1);
/**
 * Author: Zane
 * Email: 873934580@qq.com
 * Date: 2022/4/7.
 */

namespace Zane\TableHandle\Components;

use Zane\TableHandle\Base;

class Input extends Base
{
    protected $fieldType = 'string';

    public function getRules(): array
    {
        return [
            'length' => 'required|integer',
        ];
    }

    protected function getParam(): array
    {
        $param = $this->parse();
        if (isset($param['length']) && $param['length']) {
            return [$this->model->name, $param['length']];
        }

        return parent::getParam();
    }
}
